import Vue from "vue"
const bus = new Vue({
	data: {
		titleBarHeight: 60, //nav栏的 height 值
		statusBarHeight: 0, //nav栏 padding-top 的高度
		navTotalHeight: "", //nav栏 height和 padding-top 的总高度
		tabBarHeight: 60, //tabBar高度(固定)
		screenHeight: "", //当前手机屏幕高度
		windowHeight: "", //当前手机可显示高度
		windowWidth: "", //当前手机可显示宽度
		isIPX: false, //判断是否是iphoneX或以上(是否有刘海)
		system: "", //'iOS':'Android'
		platform: "H5", //当前平台
		language: "zh_cn",
	},
	watch: {},
	methods: {
		currencyHtml() {
			return this.currency
		},
		// 获取顶部导航栏高度
		getNavBarHeight() {
			const res = uni.getSystemInfoSync()
			this.screenHeight = res.screenHeight
			this.windowWidth = res.windowWidth
			this.windowHeight = res.windowHeight
			this.system = res.system.includes("iOS") ? "iOS" : "Android"
			if (navigator.userAgent.match(/Tixtak/i)) {
				this.statusBarHeight = this.system == "ios" ? 56 : 44
			} else {
				this.statusBarHeight = 5
			}
			this.navTotalHeight = this.titleBarHeight + this.statusBarHeight
		},
	},
	created() {
		this.getNavBarHeight()
	},
})
export default bus
